#pragma once
#include <string>
#include <vector>

const int DIR_IN = 0;
const int DIR_OUT = 1;

namespace gecko
{

	//---------------------------------------------------------------------------------------------

	class IStream;

	//---------------------------------------------------------------------------------------------

	// describes the file layout of a data structure
	class MetaClass
	{
	public:
		enum MemberType
		{
			Char,
			Short,
			Bool,
			Int32,
			Int64,
			Float,
			Double,
			String,
			Class,
			Pointer,
			Matrix44,
			NumTypes,
		};

		static const int MAX_NAME_LEN = 256;

		struct Member
		{
			char name[MAX_NAME_LEN];
			MemberType type;
			unsigned int dataOffset;
			unsigned int size;
		};

		typedef std::vector<Member> MemberMap;

		MetaClass(char* className, Member* memberArray, int size, MetaClass& parentClass);
		MetaClass(char* className);
		MetaClass();

		void GenerateCheckSum();
		void SerialiseMetaData(IStream& stream);
		void SerialiseObject(IStream & stream, void * object, MetaClass & objectMetaClass);

		const MemberMap & GetMemberMap() const;
		char * GetName();

		bool operator==(const MetaClass & rhs);
		bool operator!=(const MetaClass & rhs);

	private:
		MemberMap m_memberMap;
		char m_className[MAX_NAME_LEN];
		int m_version;
	};

	//---------------------------------------------------------------------------------------------
	
}